package com.itqf;

import com.itqf.di.MyContainner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/9
 * @Time: 下午12:08
 */
public class TestDI {

    public  static  void  main(String[]args){
        //1,创建ApplicationContext
        ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext-di.xml");

        //2,获取对象
        MyContainner myContainner = ac.getBean(MyContainner.class);

        System.out.println(myContainner);

        //构造器注入
        System.out.println(ac.getBean("myUser"));
        System.out.println(ac.getBean("myUser1"));

        //p标签注入
        System.out.println(ac.getBean("myUser2"));



    }

}
